package org.openrbac.rbac.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.openrbac.rbac.entity.ClassProduct;
import org.openrbac.rbac.entity.DictDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;

/**
* @author 梁富贵
* @description 针对表【dict_detail(数据字典详情)】的数据库操作Mapper
* @createDate 2024-05-15 15:20:42
* @Entity org.openrbac.rbac.entity.DictDetail
*/
@Mapper
public interface DictDetailMapper extends BaseMapper<DictDetail> {

    @Select("<script>"+
            "select `id`,`key`,`value` from `dict_detail` where id in"+
            "<foreach collection='ids' item='item' open='(' separator=',' close=')'>"+
            "#{item}"+
            "</foreach>"+
            "</script>")
    List<DictDetail> getDictDetailsByIds(@Param("ids") List<Long> ids);

    @Select("<script>"+
            "select id,`key`,value from dict_detail where dict_id in"+
            "<foreach collection='ids' item='item' open='(' separator=',' close=')'>"+
            "#{item}"+
            "</foreach>"+
            "</script>")
    List<DictDetail> getDictDetailsByDictIds(@Param("ids") List<Long> ids);

    @Select("<script>"+
            "select distinct nid,pid from class_product where pid in"+
            "<foreach collection='pids' item='item' open='(' separator=',' close=')'>"+
            "#{item}"+
            "</foreach>"+
            "</script>")
    List<ClassProduct> getClassIdsByDictIds(@Param("pids") List<Long> pids);


}




